#include "../Headers/types.h"

#include "../NS/nameserver.h"

#include "an.client.h"

#include <string>
#include <iostream>

using namespace std;
using namespace TOB;
using namespace AN;

int main() {
  
  string username, password, nshost;
  cout << "Введите им пользователя: ";
  cin >> username;
  cout << "Введите парроль: ";
  cin >> password;
  
  Nameserver::IP nsip = 0x0100007F;
  
  Client an = Client(nsip, username, password);
  if (!an.isConnected()) {
    cout << "Server does not respond." << endl;
    return 1;
  }
  int menu;
  cout << "Выбирите действие:\n 1 - login\n 2 - logout\n>> ";
  cin >> menu;
  switch (menu) {
  case 1:
    an.login();
    break;
  case 2:
    an.logout();
    break;
  default:
    cout << "Неудачник." << endl;
  }
  
  bool online;
  an.online(online);
  if (online) cout << "User online" << endl;
  else cout << "User offline" << endl;
  
  return 0;
}
